<?php

namespace app\api\controller;

use app\api\model\store\Shop as ShopModel;
use think\Db;


/**
 * 门店列表
 * Class Shop
 * @package app\api\controller
 */
class Shop extends Controller
{
    /**
     * 门店列表
     * @param string $longitude
     * @param string $latitude
     * @return array
     * @throws \think\exception\DbException
     */
    public function lists($longitude = '', $latitude = '')
    {
        $model = new ShopModel;
        $list = $model->getList(true, $longitude, $latitude);
        return $this->renderSuccess(compact('list'));
    }

    /**
     * 门店详情
     * @param $shop_id
     * @return array
     * @throws \think\exception\DbException
     */
    public function detail($shop_id)
    {
        $detail = ShopModel::detail($shop_id);
        return $this->renderSuccess(compact('detail'));
    }
     /**
      * YPP 商城设置*/
    public function get_store()
    {
        $wxapp_id = input("wxapp_id");
        $store = Db::name("setting")->where(array("key"=>"store","wxapp_id"=>$wxapp_id))->find();
        $data = json_decode($store['values'],true);
        return $this->renderSuccess(compact('data'));
    }



}